export function isMobile(source: string) {
	const exp = /1[356789]\d{9}/;
	return exp.test(source);
}

export function desensitizeMobile(
	mobile: string | null | undefined,
	mask = "*",
) {
	if (!mobile) return "";

	if (!isMobile(mobile)) {
		return mobile;
	}

	return (
		mobile.substring(0, 3) +
		new Array(4).fill(mask).join("") +
		mobile.substring(7)
	);
}
